package com.example.bysj.Controller;
//201902104061徐中堂
import com.example.bysj.domain.GraduateProjectTrueness;
import com.example.bysj.Service.GraduateProjectTruenessService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@RestController
public class GraduateProjectTruenessController {
    //生成一个实例
    @Resource
    private GraduateProjectTruenessService graduateProjectTruenessService;
    //查找全部
    @GetMapping("/graduateProjectTrueness.ctl")
    public List<GraduateProjectTrueness> findALL(){
        return graduateProjectTruenessService.findAll();
    }
    //根据id查找
    @GetMapping("/graduateProjectTrueness.ctl/{id}")
    public GraduateProjectTrueness find(@PathVariable("id") int id){
        GraduateProjectTrueness graduateProjectTrueness = graduateProjectTruenessService.find(id);
        if(graduateProjectTrueness!=null){
            return graduateProjectTrueness;
        }else {
            //自定义一个运行时异常
            throw new RuntimeException("未查询到 "+id+" !");
        }
    }
}
